const path = require("path");
const webpack = require('webpack');
const { defines, info } = require('../base/defines');
const HtmlWebpackPlugin = require("html-webpack-plugin");

module.exports = {
    entry: "./src/index.ts",
    output: {
        path: path.resolve("./dist/"),
        filename: "earthsdk2-ue.js",
        library: "earthsdk2ue",
        libraryTarget: "umd"
    },
    resolve: {
        extensions: ['.ts', '.js', '.json'],
        alias: {
            '@': path.resolve('./src/'),
        },
    },
    module: {
        rules: [{
            test: /.ts$/,
            loader: "ts-loader",
            exclude: /node_modules/,
        }],
    },
    plugins: [
        new webpack.BannerPlugin(`${info.name}(${info.version}-${info.commitId.slice(0, 8)}-${info.date}) 版权所有@${info.owner}`),
        new webpack.DefinePlugin(defines),
        new HtmlWebpackPlugin({
            template: "./index.html",
        }),
    ],
};
